#+LaTeX_CLASS: org-book
#+LATEX_HEADER: \usepackage[ngerman,USenglish]{babel}
#+LATEX_HEADER: \selectlanguage{USenglish}
#+LATEX_HEADER: \usepackage{ulem}
#+LATEX_HEADER: \usepackage{hyperref}
#+LATEX_HEADER: \usepackage{amsmath}
#+LATEX_HEADER: \usepackage{mathtools}
#+LATEX_HEADER: \usepackage{fontspec}
#+TITLE: Machine Learning Notes
#+AUTHOR: 杨小龙
#+DATE: \today \\ (work in progress)
#+LANGUAGE: USen
#+LINK_HOME: https://gitlab.com/ZelphirKaltstahl/machine-learning-notes
#+EXPORT_SELECT_TAGS: export
#+EXPORT_EXCLUDE_TAGS: noexport
#+STARTUP: showall

* How to add a bibliography to org mode Files

You can write the following in your org-mode file:

#+BEGIN_COMMENT comment
bibliography starts a new chapter
no need to write a heading for the bibliography
#+END_COMMENT

\bibliography{bibliography}

* Bibliography file format

#+BEGIN_EXAMPLE
-@online{lmu_uni_2017,
-  author = {LMU},
-  title = {ESG Data Science - LMU Munich},
-  year = 2017,
-  url = {http://www.m-datascience.mathematik-informatik-statistik.uni-muenchen.de/index.html},
-  urldate = {2017-01-21}
-}
-
-@online {jupyter_licensing_2017,
-    title = {About Project Jupyter},
-    author = {Jupyter Community},
-    journal = {None},
-    pages = {1},
-    year = {2017},
-    publisher = {Jupyter Community},
-    url = {https://jupyter.org/about.html},
-    urldate = {2017-07-10}
-}
#+END_EXAMPLE

* Org to Latex capabilities

** Images

#+CAPTION: This is the caption for the next figure link (or table)
#+NAME: fig:SED-HR4049
#+ATTR_LATEX: :width .5\textwidth :options angle=70
#+ATTR_LATEX: :float nil
#+ATTR_ORG: :width 200
[[./img/a.png]]

Call ~org-toggle-inline-images~ to toggle display of images inline.

#+BEGIN_SRC elisp
(org-toggle-inline-images)
#+END_SRC

#+RESULTS:

** Basic Tables

#+CAPTION: This is the caption for the next table (or link)
#+NAME: tab:basic-data
| ... | ... |
|-----+-----|
| a   | b   |

Link to table: [[tab:basic-data]]

** Literals

#+BEGIN_EXAMPLE -n 20
Some example from a text file.
#+END_EXAMPLE

Here is an example
   : Some example from a text file.

#+BEGIN_SRC emacs-lisp +n 20
  (defun org-xor (a b)
     "Exclusive or."
     (if a (not b) b))
#+END_SRC


#+BEGIN_SRC emacs-lisp +n 20 -i
  (defun org-xor (a b)
     "Exclusive or."
     (if a (not b) b))
#+END_SRC


* Citations

#+BEGIN_EXAMPLE
\cite[p. 435]{jupyter_licensing_2017}
#+END_EXAMPLE

* How to get latex preview in org mode?

You might need to add the following to your ~init.el~ file:

#+BEGIN_SRC elisp
;; LATEX PREVIEW IN ORG FILES
;; Use C-c C-x C-l or some command to toggle preview of latex in org mode.
(setq org-preview-latex-default-process 'dvisvgm)
(setq org-latex-inputenc-alist '(("utf8" . "utf8x")))
(add-to-list 'org-latex-packages-alist '("" "unicode-math"))

(setq org-preview-latex-process-alist
      (quote
       ((dvipng :programs
                ("xelatex" "dvipng")
                :description "dvi > png" :message "you need to install the programs: xelatex and dvipng." :image-input-type "dvi" :image-output-type "png" :image-size-adjust
                (1.0 . 1.0)
                :latex-compiler
                ("xelatex -output-format dvi -interaction nonstopmode -output-directory %o %f")
                :image-converter
                ("dvipng -fg %F -bg %B -D %D -T tight -o %O %f"))
        (dvisvgm :programs
                 ("xelatex" "dvisvgm")
                 :description "dvi > svg" :message "you need to install the programs: xelatex and dvisvgm." :use-xcolor t :image-input-type "xdv" :image-output-type "svg" :image-size-adjust
                 (1.7 . 1.5)
                 :latex-compiler
                 ("xelatex -no-pdf -interaction nonstopmode -output-directory %o %f")
                 :image-converter
                 ("dvisvgm %f -n -b min -c %S -o %O"))
        (imagemagick :programs
                     ("xelatex" "convert")
                     :description "pdf > png" :message "you need to install the programs: xelatex and imagemagick." :use-xcolor t :image-input-type "pdf" :image-output-type "png" :image-size-adjust
                     (1.0 . 1.0)
                     :latex-compiler
                     ("xelatex -no-pdf -interaction nonstopmode -output-directory %o %f")
                     :image-converter
                     ("convert -density %D -trim -antialias %f -quality 100 %O")))))
#+END_SRC
